package com.example.demo.model;

import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

@Erupt(name = "设备数据")
@Entity
@Table(name = "iot_device_data")

public class DeviceData extends HyperModel {

    @EruptField(
            views = @View(title = "设备ID"),
            edit = @Edit(title = "设备ID", search = @Search)
    )
    private String deviceId;

    @EruptField(
            views = @View(title = "温度(℃)"),
            edit = @Edit(title = "温度", type = EditType.NUMBER)
    )
    private Double temperature;

    @EruptField(
            views = @View(title = "湿度(%)"),
            edit = @Edit(title = "湿度", type = EditType.NUMBER)
    )
    private Double humidity;

    @EruptField(
            views = @View(title = "上报时间"),
            edit = @Edit(title = "上报时间", type = EditType.DATE)
    )
    private Date reportTime;

    public void setDeviceId(String deviceId) {
    }
    public void setTemperature(Double temperature) {
        this.temperature = temperature;
    }

    public void setHumidity(Double humidity) {
        this.humidity = humidity;
    }

    public void setReportTime(Date date) {
    }

    // Getters and Setters...
}